int myCmp(const void *a, const void *b) {
    return (*(int *)a) -(*(int *)b);
}
#if 0
// 出现2次相同
int* singleNumbers(int* nums, int numsSize, int* returnSize){
    qsort(nums, numsSize, sizeof(int), myCmp);
    *returnSize = 2;
    int i;
    int *ans = malloc(2 * sizeof(int)); 
    int count = 0;
    for (i = 1; i < numsSize; i++) {
        if (nums[i -1] != nums[i]) {
            ans[count] = nums[i -1];
            count++;
            if (count == 2) {
                return ans;
            }
        } else {
            i++;
        }
    }
    if (count != 2) {
        ans[count] = nums[numsSize -1];
    }
    return ans;
}
#endif
int singleNumber(int* nums, int numsSize){
    if (numsSize == 1) {
        return nums[0];
    }
    qsort(nums, numsSize, sizeof(int), myCmp);
    int i;
    for (i = 1; i < numsSize; i++) {
        if (nums[i -1] == nums[i]) {
            i += 2;
        } else {
            return nums[i -1];
        }
    }
    return nums[numsSize -1];
}